"""meiduo_mall URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  url(r'^$', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  url(r'^$', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.conf.urls import url, include
    2. Add a URL to urlpatterns:  url(r'^blog/', include('blog.urls'))
"""
from django.conf.urls import url, include
from django.contrib import admin

from . import views

urlpatterns = [
    url(r'^register/$', views.RegisterView.as_view(), name="register"),
    # 用户名是否重复
    url(r'^usernames/(?P<username>[a-zA-Z0-9_-]{5,20})/count/$', views.UsernameCountView.as_view()),
    # 手机号是否重复
    url(r'^mobiles/(?P<mobile>1[3-9]\d{9})/count/$', views.MobileCount.as_view()),
    # 登陆页面
    url(r'^login/$', views.LoginView.as_view()),
    # 退出页面
    url(r'^logout/$', views.LoginView.as_view()),
    # 用户中心路由
    url(r'^info/$', views.InfoView.as_view()),
    # 设置用户邮箱
    url(r'^emails/$', views.EmailView.as_view()),
    # 邮箱激活
    url(r'^email/verification/$', views.VerifyEmailView.as_view()),
    #     用户收货地址
    url(r'^addresses/$', views.AddressView.as_view()),
    #     用户收货地址
    url(r'^addresses/create/$', views.CreateAddressView.as_view()),
    # 用户收货地址修改和删除
    url(r'^addresses/(?P<address_id>\d+)/$', views.UpdateDestroyAddressView.as_view()),
    # 设置用户默认收货地址
    url(r'^addresses/(?P<address_id>\d+)/default/$', views.DefaultAddressView.as_view()),
    # 修改用户收货地址标题
    url(r'^addresses/(?P<address_id>\d+)/title/$', views.UpdateTitleAddressView.as_view()),
    # 修改密码
    url(r'^password/$', views.ChangePasswordView.as_view()),
    # 修浏览商品记录
    url(r'^browse_histories/$', views.HistoryGoodsView.as_view()),
    # 全部订单展示
    url(r'^orders/info/(?P<id>\d+)/$', views.AllOrderView.as_view()),
    # 商品满意度（代评价商品）
    url(r'^orders/comment/$', views.OrdersCommentView.as_view()),

    # 找回密码
    url(r'^find_password/$', views.FindPasswordView.as_view()),
    # 找回密码 验证
    url(r'^accounts/(?P<username>[a-zA-Z0-9_-]{5,20})/sms/token/$', views.VerifyPassWordView.as_view()),

    # 找回密码 短信验证
    url(r'^sms_codes/$', views.MsgVerifyView.as_view()),
    # 找回密码 短信验证2
    url(r'^accounts/(?P<username>[a-zA-Z0-9_-]{5,20})/password/token/$', views.AccountPasswordView.as_view()),
    # 找回密码 短信验证3
    url(r'^users/(?P<id>\d+)/password/$', views.UsersPasswordView.as_view()),

]
